package com.bw.my.mvvm.user;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import com.blankj.utilcode.util.LogUtils;
import com.bw.mvvm.mvvm.view.BaseActivity;
import com.bw.mvvm.utils.SpUtils;
import com.bw.my.BR;
import com.bw.my.R;
import com.bw.my.databinding.ActivityUserLoginBinding;
import com.bw.my.mvvm.user.viewmodel.LoginViewModel;


import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

public class LoginActivity extends BaseActivity<ActivityUserLoginBinding, LoginViewModel> {

    public Fragment myFragment;

    @Override
    public int bindLayout() {
        return R.layout.activity_user_login;
    }

    @Override
    public int initVerable() {
        return BR.mylogin;
    }

    @Override
    public void startActivityForResult(Intent intent, int requestCode) {
        super.startActivityForResult(intent, requestCode);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().register(this);


    }

    @Subscribe()
    public void getEventBus(String msg) {
        LogUtils.e(msg);
        if (msg.equals("登录成功"))
            finishPage();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
}
